﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace ArgusLib.Controls
{
	public class NumericDoubleTextBox : NumericTextBox<double>
	{
		public NumericDoubleTextBox()
			: base()
		{
		}

		protected override IEnumerable<CharSet> GetAllowedChars()
		{
			NumberFormatInfo nfi = NumberFormatInfo.CurrentInfo;
			StringBuilder sBuilder = new StringBuilder(nfi.NativeDigits.Length + 5);
			for (int i = 0; i < nfi.NativeDigits.Length; i++)
				sBuilder.Append(nfi.NativeDigits[i]);
			sBuilder.Append(nfi.NegativeSign);
			sBuilder.Append(nfi.NumberDecimalSeparator);
			sBuilder.Append(nfi.NumberGroupSeparator);
			sBuilder.Append(nfi.PositiveSign);
			sBuilder.Append("eE");
			return CharSet.FromChars(sBuilder.ToString());
		}
	}
}
